package com.comum.javahomework420242025.repository;

import com.comum.javahomework420242025.pojo.Quote;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface QuoteRepository extends JpaRepository<Quote, Long> {

    @Query(value = "select q from quote q where " +
            "q.chance.user.area.department=:department and (" +
            "cast(q.id as string) like %:str% or " +
            "q.chance.clientCompany.clientcompanyname like %:str% or " +
            "q.quotedate like %:str% or " +
            "q.chance.projectname like %:str% or " +
            "cast(q.allprices as string) like %:str% or " +
            "q.comment like %:str%)")
    Page<Quote> getQuote(String str,String department, Pageable pageable);
}
